#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <ui_mainwindow.h>
#include <test.hpp>
#include <QLineEdit>
#include <QFileDialog>
#include <QMessageBox>
#include <QString>
#include <QTimer>
#include <QImage>
#include <matrix.hpp>
#include <kplotobject.h>
#include <kplotaxis.h>
#include <spline.hpp>

//double filter[26] = {0.00223277425339545,	0.00472687887626425,	0.00859630239637727,	
//                 0.0140830811292919,	0.0212964332879472,	0.0301562046993192,	
//                 0.0403592343253835,	0.0513756980283830,	0.0624835663678474,	
//                 0.0728382712601111,	0.0815696785666716,	0.0878929842265178,	
//                 0.0912143968490876,	0.0912143968490876,	0.0878929842265178,	
//                 0.0815696785666716,	0.0728382712601111,	0.0624835663678474,	
//                 0.0513756980283830,	0.0403592343253835,	0.0301562046993192,	
//                 0.0212964332879472,	0.0140830811292919,	0.00859630239637727,	
//                 0.00472687887626425,	0.00223277425339545};
                


class MyWindow : public QMainWindow
{
    Q_OBJECT

public:
     MyWindow(QWidget *parent = 0);
    ~MyWindow();
     void closeEvent(QCloseEvent *);
public Q_SLOTS:
     void on_OpenFile_clicked();
     void on_Start_clicked();
     void on_Stop_clicked();
     void on_Pause_clicked();
     void on_updateImageGraph();
private:
    Ui::MainWindow *ui;
    int frames_no;
    bool video_being_processed,wire_found;
    int time, buffer_size, center_x,center_y,count,count1;
    cv::VideoCapture video_input;
    std::string current_filename,folder_name;
    std::ofstream file,file1;
    QTimer *timer;
    cv::Mat image_raw,image_processed,image_Qimage;
    std::vector<ohe_framework::ImageMatrixUchar> images;
    cv::Size image_size;
    ohe_framework::Point roi_origin,roi_pre_origin,roi_range;
    std::vector<ohe_framework::Point> wire_points;
    ohe_framework::CircularBufferPoint *vectors;
    KPlotWidget *plot;
    KPlotObject *horizontal,*radius,*vertical;
    ohe_framework::Spline *data;
    double x;
    float cur_stagger;
    float cur_height;
    int count_mast,release_mast;
    bool last_mast;
    void displayGraph();
    void displayImages();
    bool getNextFrame(cv::Mat &img);
    void applyFilter();
};

#endif // MAINWINDOW_H
